/*
 * Event.h
 *
 *  Created on: 2013-8-7
 *  Author: xnan
 */

#ifndef XNL_EVENT_CLASS_H_
#define XNL_EVENT_CLASS_H_

#include "base/Object.h"

NS_XNL_BEGIN

class Event : public Object
{
public:
    Event( Object * p_target, XNint p_eventType, Object * p_userdata = NULL );
    virtual ~Event();
    
    XNint getEventType() const;
    Object * getTarget() const;
    Object * getCurrentTarget() const;
    XNint getEventPhase() const;
    XNbool canBack() const;
    XNbool isStopImmediatePropagation() const;
    XNbool isStopPropagation() const;
    
    void setTarget( Object * p_target );
    void setCurrentTarget( Object * p_currentTarget );
    void setUserdata( Object * p_userdata );
    
    void processedEvent();
    void stopImmediatePropagation();
    void stopPropagation();
    
protected:
    Object * m_target; // 接收此事件的目标
    Object * m_currentTarget; // 当前处理事件的目标
    XNint m_eventType; // 事件类型
    Object * m_userdata; // 用户自定义数据
    XNbool m_stopImmediatePropagation; // 事件是否立刻停止
    XNbool m_stopPropagation; // 事件是否停止传递
};

NS_XNL_END

#endif /* XNL_EVENT_CLASS_H_ */
